<%--
  Created by IntelliJ IDEA.
  User: 沐硕
  Date: 2024/6/5
  Time: 21:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>发布新闻</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/layui/2.6.8/css/layui.css">
    <!-- 引入 layui 的 JavaScript 文件 -->

    <!-- 初始化 layedit -->
    <script src="https://cdn.bootcdn.net/ajax/libs/layui/2.6.8/layui.js"></script>
    <script>
        layui.use('layedit', function(){
            var layedit = layui.layedit;

            // 创建富文本编辑器
            var index = layedit.build('editor', {
                tool: [
                    'strong', // 加粗
                    'italic', // 斜体
                    'underline', // 下划线
                    'del', // 删除线
                    '|', // 分割线
                    'left', // 左对齐
                    'center', // 居中对齐
                    'right', // 右对齐
                    'link', // 超链接
                    'unlink', // 清除链接
                    'face', // 表情
                    '|', // 分割线
                    'color', // 文字颜色
                    'font' // 字体大小
                ]
            });

        });
    </script>
    <!-- 自定义样式 -->
    <style>
        body {
            background-color: #f5f5f5;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
        }
        .layui-nav-child{
            color: #0C0C0C;
        }
        .layui-header {
            background-color: #303030;
            color: #fff;
            padding: 0 15px;
        }
        .layui-header .layui-logo {
            font-size: 24px;
            line-height: 60px;
            margin-right: 30px;
        }

        .layui-side, .layui-layout-admin .layui-body, .layui-footer {
            background-color: #f5f5f5;
            color: #333;
        }
        .layui-card-header {
            background-color: #303030;
            color: #fff;
        }
        .layui-card-body {
            background-color: #fff;
            color: #333;
        }
        .layui-layout-admin .layui-body {
            padding: 15px;
        }
        .layui-side {
            background-color: #333; /* 背景颜色 */
            flex-shrink: 0;
        }
        .layui-side-scroll {
            height: 100%; /* 高度设为100% */
            overflow: auto;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <%--头部导航--%>
    <div class="layui-header">
        <a href="home.jsp">
            <div class="layui-logo layui-hide-xs">新闻发布系统</div>
        </a>
        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a>用户管理</a></li>
            <li class="layui-nav-item"><a>新闻管理</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                <a href="home.jsp">
                    <img src="../image/back-image.jpg" class="layui-nav-img"> <!-- 修改为实际用户头像链接 -->
                    <%= session.getAttribute("username") %>
                </a>
                <dl class="layui-nav-child" style="color: #0C0C0C">
                    <dd><a href="home.jsp">首页</a></dd>
                    <dd><a href="info.jsp">个人信息</a></dd>
                    <dd><a href="setting.jsp">设置</a></dd>
                    <dd><a href="../home/login-2.jsp;">退出</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a>
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>
    <div class="layui-side">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域 -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a>用户管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="../SearchAllServlet.do;">用户查询</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a>新闻管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="NewsPublish.jsp">新闻发布</a></dd>
                        <dd><a href="../NewsServlet.do">新闻浏览</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
        <div class="layui-container">
            <div class="layui-body">
                <!-- 内容主体区域 -->
                <div class="form-container">
                    <h2 class="form-title">发布新闻</h2>
                    <form class="layui-form" action="../NewsServlet.do" method="post" enctype="multipart/form-data">
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">作者</label>
                            <div class="layui-input-block">
                                <input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">内容</label>
                            <div class="layui-input-block">
                                <textarea id="editor" name="content" class="layui-textarea" style="display: none;"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">图片</label>
                            <div class="layui-input-block">
                                <input type="file" name="image" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

</div>
</body>
</html>
